package com.ihr360.job.core.step.builder;

import com.ihr360.job.core.step.StepBuilderHelper;
import com.ihr360.job.core.step.tasklet.Tasklet;

/**
 * Builder for tasklet step based on a custom tasklet (not item oriented).
 *
 * @author Dave Syer
 *
 * @since 2.2
 */
public class TaskletStepBuilder extends AbstractTaskletStepBuilder<TaskletStepBuilder> {

    private Tasklet tasklet;

    /**
     * Create a new builder initialized with any properties in the parent.  The parent is copied, so it can be re-used.
     *
     * @param parent a parent helper containing common step properties
     */
    public TaskletStepBuilder(StepBuilderHelper<?> parent) {
        super(parent);
    }

    /**
     * @param tasklet the tasklet to use
     * @return this for fluent chaining
     */
    public TaskletStepBuilder tasklet(Tasklet tasklet) {
        this.tasklet = tasklet;
        return this;
    }

    @Override
    protected Tasklet createTasklet() {
        return tasklet;
    }

}